package com.qfjy.homework.liunian;

/**
 * @author : liunian
 * @date :2022/11/10 19:02
 * @VERSION : 1.0
 */
public class ProxyImage implements Image {

    //在代理类中
    private RealImage realImage;
    //创建真类
    private String fileName;

    public ProxyImage(String fileName){
        this.fileName = fileName;
        System.out.println("代理类构造方法");
    }

    @Override
    public void display() {
        System.out.println("执行了代理类");

        System.out.println("获取信息调用真类");
        realImage = new RealImage(fileName);
        System.out.println("信息为"+fileName);

        //调用真类
        realImage.display();

    }
}
